package com.zr.inquiry.mapper;


import com.zr.inquiry.pojo.*;
import com.zr.lagalplant.pojo.LegalPerson;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import javax.validation.constraints.NotNull;
import java.util.List;


/**
 * Created by Hasee on 2019/10/9.
 */
@Mapper
public interface InquiryMapper {

    void addTotal(InquiryTotal inquiryTotal);

    void addBeiMingxi(List<Inquirysparedetail> inquirysparedetailList);

    void addGongMingxi(List<Inquirysupplierdetail> inquirysupplierdetailList);

    @Select("select * from legalperson where id=#{legalPersonId}")
    LegalPerson queryLegalPerson(@NotNull(message = "法人Id不能为空！") Integer legalPersonId);

    List<String> querySparePartByCodeList(List<String> codeList);

    List<SpareSupplier> querySpareSupplierByCodeList(List<String> codeList);

    List<String> querySupplierCodeList(List<String> supplierList);

    List<SpareSupplier> querySpareSpareByCodeList(List<String> supplierList);


    List<Inquirysparedetail> querySpare(SparedetailClassVo sparedetailClassVo);

    List<Inquirysupplierdetail> querySupplier(SupplierClassVo supplierClassVo);

    void updateTotal(InquiryTotal inquiryTotal);

    @Delete("delete from inquirysparedetail where  inquiryId=#{inquiryId}")
    void deleteBeiMingxi(Integer id);

    @Delete("delete from inquirysupplierdetail where  inquiryId=#{inquiryId}")
    void deleteGongMingxi(Integer id);

    List<InquiryTotal> queryData(InquirySelectVo inquirySelectVo);

    int queryCount(InquirySelectVo inquirySelectVo);

    @Select("select * from inquirytotal where id = #{id}")
    InquiryTotal queryById(Integer id);

    @Select("select * from inquirysparedetail where inquiryId=#{inquiryId}")
    List<Inquirysparedetail> querySparePartByTotalId(Integer id);

    @Select("select * from inquirysupplierdetail where inquiryId=#{inquiryId}")
    List<Inquirysupplierdetail> querySupplierByTotalId(Integer id);
}
